We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I found an unreachable error case in discord.shard or shard.py
Hello! I found an unreachable error case in https://github.com/Rapptz/discord.py/blob/master/discord/shard.py#L520-523 this snippet here when i was browsing the library code,
the snippet is as follows:
if item.error.code != 1000: raise item.error if item.error.code == 4014: raise PrivilegedIntentsRequired(item.shard.id) from None
as you can see, the second error case is completely unreachable, as in order to reach there .code must be 4014, which it cannot
further more, setting type checker mode to strict will show us this error:
Condition will always evaluate to False since the types "Literal[1000]" and "Literal[4014]" have no overlap
https://github.com/Rapptz/discord.py/blob/master/discord/shard.py#L151-L157 here is an example where it is correctly written
code = 4014 if item.error.code != 1000: raise ValueError("generic raise") if item.error.code == 4014: raise ValueError("specific raise")
Unrelated
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
Summary
I found an unreachable error case in discord.shard or shard.py
Reproduction Steps
Hello! I found an unreachable error case in https://github.com/Rapptz/discord.py/blob/master/discord/shard.py#L520-523 this snippet here when i was browsing the library code,
the snippet is as follows:
as you can see, the second error case is completely unreachable, as in order to reach there .code must be 4014, which it cannot
further more, setting type checker mode to strict will show us this error:
https://github.com/Rapptz/discord.py/blob/master/discord/shard.py#L151-L157
here is an example where it is correctly written
Minimal Reproducible Code
Expected Results
Unrelated
Actual Results
Unrelated
Intents
Unrelated
System Information
Checklist
Additional Context
No response
The text was updated successfully, but these errors were encountered: